{extend name="default/template/base_index"/}

{block name="area_body"}

    {include file="default/Widget/topbar" /}
    <div class="admin-main container-fluid">
        {include file="default/Widget/left" /}
        <div class="admin-main-content">
            {include file="default/Widget/breadcrumb" /}
            <!-- 标题栏 -->
            <div class="main-title">
                <h2>{$title}内容列表</h2>
            </div>

            <div class="cf">
                <div class="fl">
                    {eq name="model.extend" value="1"}
                        <div class="tools">
                            <a class="btn" href="{:url('edit',array('name'=>$name))}">新 增</a>
                            <button class="btn ajax-post confirm" target-form="ids" url="{:url('del?name='.$name)}">删 除
                            </button>
                        </div>
                    {/eq}
                </div>
            </div>

            <!-- 数据列表 -->
            <div class="data-table table-striped">
                {empty name="custom_adminlist"}
                    <!-- 数据列表 -->
                    <table>
                        <thead>
                        <tr>
                            <th width="50">
                                <input class="check-all" type="checkbox">序号
                            </th>
                            {volist name="list_grid" id="vo"}
                                <th>{$vo.title}</th>
                            {/volist}
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="_list" id="lv" key="vo"}
                            <tr>
                                <td>
                                    <input class="ids" type="checkbox" value="{$lv.id}" name="ids[]">{$lv.id}</td>
                                {volist name="list_grid" id="lk"}
                                    <td>{:get_addonlist_field($lv, $lk, $name)}</td>
                                {/volist}
                            </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {else/}
                    {present name="custom_adminlist"}
                        {$custom_adminlist}
                    {/present}
                {/empty}
            </div>
            <!-- 分页 -->
            <div class="page">
                {$_page}
            </div>
        </div>
    </div>

{/block}
{block name="area_footer"}
    <script type="text/javascript">
        $(function () {

            //搜索功能
            $("#search").click(function () {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            $('.data-table th:last').attr('width', 70);
            //回车自动提交
            $('.search-form').find('input').keyup(function (event) {
                if (event.keyCode === 13) {
                    $("#search").click();
                }
            });
        })
    </script>
{/block}
